<!-- 聊天记录模式演示(vue)，vue中目前无法解决分页闪动问题，使用nvue可实现聊天记录无闪动分页 -->
<template>
	<view class="content">
		
		<z-paging ref="paging" v-model="dataList" use-chat-record-mode use-page-scroll @query="queryList()">
			<view :id="`z-paging-${index}`" v-for="(item,index) in dataList" :key="index">
				<view class="warp">
					<view class="time">
						{{item.payDeadline}}
					</view>
					<view class="boder">
						<view class="top">
							<image class="img" src="../../static/image/zhifu.png" mode=""></image>
							<text>{{item.billTitle}}</text>
						</view>
						<view class="middle">
							<view class="bg-image"></view>
							<text style="font-size: 32rpx;">支付金额</text>
							<text style="font-size: 72rpx; color: #ff615d;">￥{{item.payBillAmount}}</text>
						</view>
						<view class="bottom" @click="billDetailsTo(item.billId)">
							<view class="left">
								<text>查看账单详情</text>
							</view>
							<view class="right">
								<text>></text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</z-paging>
		<view class="bot">
			<view class="bottom_menu">
			<view class="weijiaofei" @click="weijiaofei()">
				<text>未缴费</text>
			</view>
				<view class="shu">
					|
				</view>
				<view class="yijiaofei">
					<text>已缴费</text>
				</view>
			</view>
		</view>
	
	<view class="whole" v-if="isShow==true">
		<image class="image" src="/static/image/zanwushuju@2x.png" mode="aspectFit"></image>
		<text>暂无数据</text>
	</view>
	
	</view>
</template>

<script>
	export default {
		name: "bottom-menu",
		data() {
			return {
				//v-model绑定的这个变量不要自己赋值、不要自己赋值、不要自己赋值！！！
				dataList: [],
				tabIndex: 0,
				newIndex: 0,
				pageNumber: 1,
				curPageData: '',
				curPageLen: '',
				memberName: '',
				isShow:false
			}
		},
		onPageScroll(e) {
			if (e.scrollTop < 10) {
				this.$refs.paging.doChatRecordLoadMore();
			}
		},
		methods: {
			queryList() {
				this.memberName = uni.getStorageSync('memberName')
				uni.request({
					url: 'http://pm.gxtimeloit.com:10030/api-cost/bill/?peopleName=' + this.memberName + 
						'&billStatus=2&pageNumber=' +
						this.pageNumber,

					success: (res) => {
						this.curPageData = res.data.body.costBill.data;
						this.curPageLen = this.curPageData.length;
						// curPageData.reverse()
						this.$refs.paging.complete(this.curPageData);
						this.pageNumber++
					},
				})
				// this.memberName=''
				if(this.memberName===null||this.memberName===''){
					this.isShow=true;
				}
			},
			billDetailsTo(billId) {
				uni.navigateTo({
					url: "/pages/billQuery/billDetails?billId=" + billId,
				})
			},
			onPullDownRefresh() {
				// console.log('refresh');
				setTimeout(function() {
					uni.stopPullDownRefresh();
				}, 1000);
			},
			weijiaofei() {
				uni.redirectTo({
					url: '/pages/billQuery/index'
				})
			}
		}
	}
</script>

<style lang="less">
	.content {
		display: flex;
		flex-direction: column;
	}

	.warp {
		margin-top: 30rpx;
		margin-bottom: 120rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.time {
		text-align: center;
		font-size: 28rpx;
		margin-bottom: 20rpx;
	}

	.boder {
		height: 410rpx;
		width: 98%;
		display: flex;
		flex-direction: column;
		// border: 1rpx solid;
		background-color: #FFFFFF;
	}

	.top {
		display: flex;
		text-align: center;
		align-items: center;
		height: 80rpx;
		border-bottom: 1rpx solid #959595;
	}

	.img {
		width: 50rpx;
		height: 50rpx;
		margin-right: 20rpx;
		margin-left: 20rpx;
	}

	.middle {
		height: 250rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		text-align: center;
		background: url(../../static/image/yijiaofei-beifen@2x.png) no-repeat right;
		background-size: 180rpx;
	}

	.bg-image {}

	.bottom {
		border-top: 1rpx solid #959595;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.left {
		margin-left: 20rpx;
	}

	.right {
		margin-right: 20rpx;
	}

	.bot {
		position: fixed;
		right: 0;
		bottom: calc(var(--window-bottom));
		left: 0;
		z-index: 1030;
		/* margin-bottom: 6; */
	}

	.bottom_menu {
		height: 100rpx;
		background-color: #FFFFFF;
		display: flex;
		flex-direction: row;
		align-items: center;
		border-top: 1rpx solid #cecece;
	}

	.yijiaofei {
		height: 100rpx;
		width: 50%;
		/* border-right: 1rpx solid #cecece; */
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 36rpx;
		border-bottom: 20rpx solid #DD524D;
	}

	.weijiaofei {
		height: 100rpx;
		width: 50%;
		// border-right:1rpx solid ;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 36rpx;
	}
	
	.whole {
		text-align: center;
		font-size: 60rpx;
		color: #959595;
	
		.image {
			margin: 320rpx 0 50rpx 0;
			width: 100%;
			height: 350rpx;
		}
	}
</style>
